
import {simpleServer} from '@/tools/servers'

/**
 * 商家
 */
export class BusinessService {
    // 分页查询列表
    static findBusinesss (pageDTO) {
        var httpMethod = 'POST';
        var body = simpleServer.getArgs(this.findBusinesss,arguments,'POST');
        return simpleServer.connection(httpMethod, '/simple/businessRegistration/Business/findBusinesss', body);
    }


    //根据商家Id查询商家
    static findBusiness (businessId) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.findBusiness ,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/businessRegistration/Business/findBusiness',body);
    }

    static switchStatus(data){
      var httpMethod = 'POST';
      var body = simpleServer.getArgs(this.switchStatus,arguments,'Post')
      return simpleServer.connection(httpMethod,'/simple/businessRegistration/Business/switchStatus',body);
  }
  // static switchStatus(data) {
  //   return simpleServer.connection('GET', '/simple/businessRegistration/Business/switchStatus', {params: data});
  // }

    //为了编辑,根据商家Id查询商家
    static findBusinessForEdit(businessId) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.findBusinessForEdit ,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/businessRegistration/Business/findBusinessForEdit',body);
    }

    //为了查看,根据商家Id查询商家，所有外键字段的名称都已加载
    static findBusinessForView(businessId) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.findBusinessForView ,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/businessRegistration/Business/findBusinessForView',body);
    }

    //创建新的商家
    static createBusiness() {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.createBusiness,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/businessRegistration/Business/createBusiness',body);
    }

    //保存商家
    static saveBusiness(business) {
        var httpMethod = 'POST';
        var body = simpleServer.getArgs(this.saveBusiness,arguments,'POST');
        return simpleServer.connection(httpMethod, '/simple/businessRegistration/Business/saveBusiness', body);
    }

    //编辑商家
    static updateBusiness (business) {
        var httpMethod = 'POST';
        var body = simpleServer.getArgs(this.updateBusiness,arguments,'POST');
        return simpleServer.connection(httpMethod, '/simple/businessRegistration/Business/updateBusiness', body);
    }

    //根据商家Id删除商家
    static deleteBusiness (businessId) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.deleteBusiness,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/businessRegistration/Business/deleteBusiness',body);
    }

    //为了查看,根据商家Id查询商家，只加载ID 和 名称
    static findBusinesssWithIdNameById(businessId) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.findBusinesssWithIdNameById ,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/businessRegistration/Business/findBusinesssWithIdNameById',body);
    }

    //为了查看,根据商家 名称 查询商家，只加载ID 和 名称
    static findBusinesssWithIdNameByName(businessName) {
        var httpMethod = 'GET';
        var body = simpleServer.getArgs(this.findBusinesssWithIdNameByName ,arguments,'GET');
        return simpleServer.connection(httpMethod, '/simple/businessRegistration/Business/findBusinesssWithIdNameByName',body);
    }

    static findAllUploadedFilesByIdAndName(id ,name) {
      var httpMethod = 'GET';
      var body = simpleServer.getArgs(this.findAllUploadedFilesByIdAndName,arguments,'GET');
      return simpleServer.connection(httpMethod,'/simple/attachment/Attachment/findAllUploadedFilesByIdAndName',body);
    }

    static downloadAttachments (isOnline,fileAddress){
      var httpMethod = 'GET';
      var body = simpleServer.getArgs(this.downloadAttachments,arguments,'GET');
      return simpleServer.connection(httpMethod,'/simple/attachment/Attachment/download',body)
    }

    static findBusinessWithName (businessName) {
      var httpMethod = 'GET';
      var body = simpleServer.getArgs(this.findBusinessWithName,arguments,'GET');
      return simpleServer.connection(httpMethod,'/simple/businessRegistration/Business/findBusinessWithName',body);
    }


}
